//
//  UIImageView+Utils.m
//  lvgouProjectIphone
//
//  Created by 张明磊 on 14-3-26.
//  Copyright (c) 2014年 lvgou. All rights reserved.
//

#import "UIImageView+Utils.h"
#import "UIImage+Utils.h"

@implementation UIImageView (Utils)

#pragma mark - 加载压缩图片 -
/**
 *  加载压缩图片
 */
- (void)setImageScalingWithFileName:(NSString *)filename;
{
    @autoreleasepool
    {
        NSString *imageFile = [[NSString alloc]initWithFormat:@"%@/%@",[[NSBundle mainBundle] resourcePath], filename];
        UIImage *image =  [[UIImage alloc] initWithContentsOfFile:imageFile];
        UIImage *image_scaling;
        if([UIScreen mainScreen].currentMode.size.width == 320)
        {
            image_scaling = [image imageByScalingAndCroppingForSize:CGSizeMake(self.frame.size.width, self.frame.size.height)];
        }
        else
        {
            image_scaling = [image imageByScalingAndCroppingForSize:CGSizeMake(self.frame.size.width, self.frame.size.height)];
        }
        [self setImage:image_scaling];
    }
}

@end
